#include <windows.h>
#include <Tlhelp32.h>

void killer(const char * exeName)
{
	HANDLE hndl = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
	DWORD dwsma = GetLastError();
	DWORD dwExitCode = 0;
	PROCESSENTRY32  procEntry={0};
	procEntry.dwSize = sizeof( PROCESSENTRY32 );
	Process32First(hndl,&procEntry);
	do
	{
		if(!_strcmpi(procEntry.szExeFile, exeName))
		{
			
			HANDLE hHandle;
			hHandle = OpenProcess(PROCESS_ALL_ACCESS,0,procEntry.th32ProcessID);

			GetExitCodeProcess(hHandle,&dwExitCode);
			TerminateProcess(hHandle,dwExitCode);


			return;
		}
	
	} while (Process32Next(hndl,&procEntry));
}